<template>
  <div class="waper">
    <div class="title">
      <div class="items">
        <span class="i-1">需求收集</span>
      </div>
      <div class="items">
        <span class="i-2">流程开发</span>
      </div>
      <div class="items">
        <span class="i-3">运行上线</span>
      </div>
    </div>
    <div class="box-sum">
      <div class="box1">
        <div class="text-num"> {{ info.requireNum }} </div>
        <div class="regular-triangle"></div>
      </div>
      <div class="box2">
        <div class="text-num">{{ info.developNum }}</div>
        <div class="regular-triangle"></div>
      </div>
      <div class="box3">
        <div class="text-num">{{ info.onlineNum }}</div>
        <div class="regular-triangle"></div>
      </div>
    </div>
    <div class="probability">
      <div class="pro-item">
        <div class="text-item">
          <p>需求通过率</p>
          <p class="bfb"><count-to :endVal="info.passRate" :delay="delay"></count-to>%</p>
        </div>
      </div>
      <div class="pro-item">
        <div class="text-item">
          <p>需求上线率</p>
          <p class="bfb bfb-color"
            ><count-to :endVal="info.onlineRate" :delay="delay"></count-to>%</p
          >
        </div>
      </div>
    </div>
  </div>
</template>

<script lang="ts" setup>
  import { computed, nextTick, onMounted, ref, watch, reactive } from 'vue'
  import { CountTo } from 'vue3-count-to'
  const props = defineProps({
    info: {
      type: Object,
      default: () => ({})
    }
  })
  const delay = ref<number>(2000)

  const renderChart = () => {
    const info = reactive(props.info.data)
  }
  watch(
    props,
    () => {
      renderChart()
    },
    {
      deep: true
    }
  )
  onMounted(() => {
    nextTick(() => {
      renderChart()
    })
  })
</script>
<style lang="scss" scoped>
  .waper {
    display: flex;
    justify-content: space-around;
    align-items: center;
    .title {
      display: flex;
      flex-direction: column;
      align-items: flex-end;
      font-size: 14px;
      color: #ffffff;
      font-family: Microsoft YaHei;
      .items {
        height: 46px;
        padding-top: 15px;
        position: relative;
        span {
          display: inline-block;
          width: 78px;
          height: 19px;
          position: absolute;
        }
        .i-1 {
          left: 4px;
        }
        .i-2 {
          left: 13px;
        }
        .i-3 {
          left: 34px;
        }
      }
    }
    .box-sum {
      text-align: center;
      width: 183px;
      //   padding-left: 27px;
      .box1 {
        border-top: 46px solid #11a7e6;
        border-left: 16px solid transparent;
        border-right: 16px solid transparent;
        height: 46px;
        width: 167px;
        position: relative;
        .text-num {
          font-size: 14px;
          font-family: Microsoft YaHei;
          color: #ffffff;
          position: absolute;
          top: -32px;
          left: -14px;
          z-index: 2;
          height: 46px;
          width: 167px;
          opacity: 0.7;
        }
        .regular-triangle {
          position: absolute;
          top: -5px;
          border-bottom: 5px solid #50beed;
          border-left: 2px solid transparent;
          border-right: 2px solid transparent;
          height: 4px;
          width: 135px;
          text-align: center;
        }
      }
      .box2 {
        border-top: 46px solid #108ec6;
        border-left: 16px solid transparent;
        border-right: 16px solid transparent;
        height: 46px;
        width: 136px;
        position: relative;
        margin-left: 16px;
        .text-num {
          font-size: 14px;
          font-family: Microsoft YaHei;
          color: #ffffff;
          position: absolute;
          top: -34px;
          left: -14px;
          z-index: 2;
          height: 46px;
          width: 136px;
          opacity: 0.7;
        }
        .regular-triangle {
          position: absolute;
          top: -5px;
          border-bottom: 5px solid #42a1cb;
          border-left: 2px solid transparent;
          border-right: 2px solid transparent;
          height: 4px;
          width: 104px;
        }
      }
      .box3 {
        border-top: 46px solid #0e6a96;
        border-left: 16px solid transparent;
        border-right: 16px solid transparent;
        height: 46px;
        width: 104px;
        position: relative;
        margin-left: 32px;
        .text-num {
          font-size: 14px;
          font-family: Microsoft YaHei;
          color: #ffffff;
          position: absolute;
          top: -34px;
          left: -14px;
          z-index: 2;
          height: 46px;
          width: 104px;
          opacity: 0.7;
        }
        .regular-triangle {
          position: absolute;
          top: -5px;
          border-bottom: 5px solid #2e7699;
          border-left: 2px solid transparent;
          border-right: 2px solid transparent;
          height: 4px;
          width: 72px;
        }
      }
    }
    .probability {
      display: flex;
      flex-direction: column;
      align-items: flex-end;
      .pro-item {
        height: 69px;
        text-align: center;
        position: relative;
        .text-item {
          width: 80px;
          height: 69px;
          position: absolute;
          left: -81px;
          top: 18px;
          font-size: 14px;
          color: #ffffff;
          font-family: Microsoft YaHei;
          .bfb {
            font-family: DIN;
            font-weight: bold;
            color: #00ffe3;
            font-size: 18px;
            margin-top: 4px;
          }
        }
      }
    }
  }
  .bfb-color {
    color: #38d3ff !important;
  }
</style>
